/*
 * Copyright (c) 2014 MrEngineer13
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sergivonavi.materialbanner.app;

import com.sergivonavi.materialbanner.app.utils.DimenUtil;
import com.sergivonavi.materialbanner.app.utils.GetButtonUtil;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;

import ohos.agp.components.Button;
import ohos.app.Context;

import org.junit.Assert;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Banner的测试类
 */
public class BannerTest {
    /**
     * onStart
     */
    @Test
    public void onStart() {
    }

    /**
     * 测试DimenUtil.getDimenValue方法的值是否正确
     */
    @Test
    public void TestDimen() {
        Context appContext = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        int dimenValue = DimenUtil.getDimenValue(appContext, 10);
        assertThat(dimenValue, is(30));
    }

    /**
     * 测试DimenUtil.getDimen方法的值是否正确
     */
    @Test
    public void TestDimenRes() {
        Context appContext = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        int dimen = DimenUtil.getDimen(appContext, ResourceTable.Integer_mb_line_height);
        assertThat(dimen, is(3));
    }

    /**
     * 测试左边的Button是否能正常获取
     */
    @Test
    public void TestGetLeftButton() {
        Context appContext = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Button leftButton = GetButtonUtil.getLeftButton(appContext);
        Assert.assertNotNull(leftButton);
    }

    /**
     * 测试右边的Button是否能正常获取
     */
    @Test
    public void TestGetRightButton() {
        Context appContext = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Button rightButton = GetButtonUtil.getRightButton(appContext);
        Assert.assertNotNull(rightButton);
    }
}
